export async function polling(handle: Function, judgeParams: {
    time: number;
    fn: Function
}) {
    let data = await handle();
    while(!(judgeParams.fn(data))) {
        await new Promise((resolve, reject) => {
            setTimeout(() => {
                resolve(true);
            }, judgeParams.time)
        });
        data = await handle();
        console.log('data',data)
    }
    return Promise.resolve(data);
}